package ysq.xyg.sale.model.po;

import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 销售模块-订单信息实体类
 *
 * @author shengQiang yu
 * @date 2019-9-9 14:28:03
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_sale_detail")
public class SaleDetail implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 用户id
     */ 
	@Column(name = "user_id")
	private String userId;
	/**
	 * 我的商品id
	 */
	@Column(name = "product_my_id")
	private String productMyId;
	/**
     * 商品id
     */ 
	@Column(name = "product_id")
	private String productId;
	
	/**
     * 价格
     */ 
	@Column(name = "money")
	private String money;
	
	/**
     * 到期时间
     */ 
	@Column(name = "end_time")
	private Date endTime;

	/**
	 * 到期时间
	 */
	@Transient
	private String endTimeStr;

	/**
     * 备注
     */ 
	@Column(name = "remarks")
	private String remarks;
	
	/**
     * 删除标识：1、正常，2、已删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;

	/**
	 * 用户名
	 */
	@Transient
	private String userName;
	/**
	 * 登录名
	 */
	@Transient
	private String loginName;
	/**
	 * 用户手机号
	 */
	@Transient
	private String userPhone;

	/**
	 * 栏目id
	 */
	@Transient
	private String productColId;

	/**
	 *商品名称
	 */
	@Transient
	private String productName;


	public SaleDetail(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}